/**
 * Copyright (c) 2024-2025 National Fundamental Software of China Co., Ltd.
 *
 * You should have find a copy of NFSChina License. If not, please contact us
 * by email <os_support@nfschina>
 *
**/

/*
 * SPDX-FileCopyrightText: 2021 Noah Davis <noahadvs@gmail.com>
 * SPDX-License-Identifier: LGPL-2.0-or-later
 */

import QtQuick 2.15
import QtQuick.Templates 2.15 as T
import QtQml 2.15
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 3.0 as PC3

EmptyPage {
    id: root
    property real preferredSideBarWidth: applicationsPage.implicitSideBarWidth
    property int page: 0

    contentItem: HorizontalStackView {
        id: stackView
        focus: true
        reverseTransitions: root.page === 1
        initialItem: ApplicationsPage {
            id: applicationsPage
            preferredSideBarWidth: root.preferredSideBarWidth
        }

        Component {
            id: categoriesPage
            CategoriesPage {
                preferredSideBarWidth: root.preferredSideBarWidth
            }
        }
    }

    function toggle_contentItem(currentPage) {
        root.page = currentPage
        if (currentPage === 0) {
            stackView.replace(applicationsPage)
        } else {
            stackView.replace(categoriesPage)
        }
    }
}
